//
//  ViewController.m
//  Depressed.domo
//
//  Created by rimi on 16/5/26.
//  Copyright © 2016年 薛涛. All rights reserved.
//

#import "ViewController.h"
#import "CustomTableViewCell.h"
/**1-10*/
#import "OneViewController.h"
#import "TwoViewController.h"
#import "ThreeViewController.h"
#import "FourViewController.h"
#import "FiveViewController.h"
#import "SixViewController.h"
#import "SevenViewController.h"
#import "EightViewController.h"
#import "NineViewController.h"
#import "TenViewController.h"
/**11-20*/
#import "ElevenViewController.h"
#import "TwelveViewController.h"
#import "ThirteenViewController.h"
#import "FourteenViewController.h"
#import "FifteenViewController.h"
#import "SixteenViewController.h"
#import "SeventeenViewController.h"
#import "EighteenViewController.h"
#import "NineteenViewController.h"
#import "TwentyViewController.h"
/**21-30*/
#import "TwentyOneViewController.h"
#import "TwentyTwoViewController.h"
#import "TwentyThreeViewController.h"
#import "TwentyFourViewController.h"
#import "TwentyFiveViewController.h"
#import "TwentySixViewController.h"
#import "TwentySevenViewController.h"
#import "TwentyEightViewController.h"
#import "TwentyNineViewController.h"
#import "ThirtyViewController.h"
/**31-40*/
#import "ThirtyoneViewController.h"
#import "ThirtytwoViewController.h"
#import "ThirtythreeViewController.h"
#import "ThirtyfourViewController.h"
#import "ThirtyfiveViewController.h"
#import "ThirtysixViewController.h"
#import "ThirtysevenViewController.h"
#import "ThirtyeigthViewController.h"
#import "ThirtynineViewController.h"
#import "FortyViewController.h"





@interface ViewController ()<UITableViewDelegate,UITableViewDataSource>
/**声明表格视图*/
@property(nonatomic,strong)UITableView *tableView;
/**声明一个标题数据源数组*/
@property(nonatomic,strong)NSMutableArray *LabelArray;
/**声明一个类目标识符的数组*/
@property(nonatomic,strong)NSMutableArray *PageArray;
/**声明一个数字的数组*/
@property(nonatomic,strong)NSMutableArray *NumberArray;
/**声明一个图片的数组*/
@property(nonatomic,strong)NSMutableArray *imagesArray;
@end

@implementation ViewController

- (instancetype)initWithCoder:(NSCoder *)aDecoder
{
    self = [super initWithCoder:aDecoder];
    if (self) {
        self.title = @"学习之路";
    }
    return self;
}


- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    [self initUserInterface];
    [self initDataSource];
    NSLog(@"123");
    
}



/**数据源*/
- (void)initDataSource{
    _LabelArray = @[@"UIPickerView",@"UIDatePicker",
                    @"CollectionView",@"手势、动画、触摸",
                    @"文本框、按钮、标签",
                    @"视图、视图控制器",
                    @"字体",@"开关、活动指示器",
                    @"滑条、分段控制器",@"计步器",@"导航控制器",
                    @"单例传值_Test、",@"适配、",@"UIScrollView",
                    @"UITableView",
                    @"下拉刷新",@"绘图曲线",@"地图、定位",
                    @"解档归档",@"Model、plist存数据",
                    @"CollectionView瀑布流",
                    @"自定义CollectionView",@"点击获取坐标",
                    @"MVC、MVVM、有问题",@"block传值_Test",
                    @"协议代理传值_Test",@"动画",@"二维码生成",
                    @"腾讯框架",@"网易新闻框架",@"动画1",@"动画2",
                    @"动画3",@"Runtime_domo",@"数据持久化",@"画框",@"CoreData",@"UIView封装",@"图片动画",@"音乐播放器",].mutableCopy;
    
    _PageArray=@[@"OneViewController",@"TwoViewController",
                 @"ThreeViewController",
                 @"FourViewController",@"FiveViewController",
                 @"SixViewController",
                 @"SevenViewController",@"EightViewController",
                 @"NineViewController",
                 @"TenViewController",@"ElevenViewController",
                 @"TwelveViewController",
                 @"ThirteenViewController",@"FourteenViewController",
                 @"FifteenViewController",
                 @"SixteenViewController",@"SeventeenViewController",
                 @"EighteenViewController",
                 @"NineteenViewController",@"TwentyViewController",
                 @"TwentyOneViewController",
                 @"TwentyTwoViewController",@"TwentyThreeViewController",
                 @"TwentyFourViewController",
                 @"TwentyFiveViewController",@"TwentySixViewController",
                 @"TwentySevenViewController",
                 @"TwentyEightViewController",@"TwentyNineViewController",
                 @"ThirtyViewController",
                 @"ThirtyoneViewController",
                 @"ThirtytwoViewController",
                 @"ThirtythreeViewController",
                 @"ThirtyfourViewController",
                 @"ThirtyfiveViewController",
                 @"ThirtysixViewController",
                 @"ThirtysevenViewController",
                 @"ThirtyeigthViewController",
                 @"ThirtynineViewController",
                 @"FortyViewController"].mutableCopy;
    
    _NumberArray = [NSMutableArray arrayWithObjects:@"01、",@"02、",@"03、",@"04、",@"05、",
                         @"06、",@"07、",@"08、",@"09、",@"10、",
                         @"11、",@"12、",@"13、",@"14、",@"15、",
                         @"16、",@"17、",@"18、",@"19、",@"20、",
                         @"21、",@"22、",@"23、",@"24、",@"25、",
                         @"26、",@"27、",@"28、",@"29、",@"30、",
                         @"31、",@"32、",@"33、",@"34、",@"35、",
                         @"36、",@"37、",@"38、",@"39、",@"40、",nil];
    
}


/**界面*/
-(void)initUserInterface{
    [self.view addSubview:self.tableView];
}


-(UITableView *)tableView{
    if (!_tableView) {
        _tableView = [[UITableView alloc]initWithFrame:self.view.frame style:UITableViewStylePlain];
        _tableView.rowHeight = 60;
        _tableView.delegate = self;
        _tableView.dataSource = self;
    }
    return _tableView;
}


#pragma mark - UITableViewDelegate,UITableViewDataSource
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return _LabelArray.count;
}


-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString *cellIdentifer = @"cell";
    CustomTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
    if (!cell) {
        cell = [[CustomTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifer];
    }
    
    cell.Titlelabel.text = _LabelArray[indexPath.row];
    cell.Stringlabel.text = _NumberArray[indexPath.row];
    cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
    return cell;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    /**取消选中状态*/
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    
    //    第一种class转nstring
    
    Class controllerClass = NSClassFromString(_PageArray[indexPath.row]);
    UIViewController *viewController = [[controllerClass alloc]init];
    [self.navigationController pushViewController:viewController animated:YES];
    /**用 UIStoryboard 推送*/
    
    //    UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@"Storyboard10" bundle:nil];
    //    UIViewController *vc = [storyBoard instantiateViewControllerWithIdentifier:@"sss"];
    //    [self presentViewController:vc animated:YES completion:nil];
    
    //   第二种 if判断
    
    //    if (indexPath.row == 0) {
    //        OneViewController *one = [[OneViewController alloc]init];
    //        [self.navigationController pushViewController:one animated:YES];
    //    }
}

@end
